"Bazel dependencies"

module(
    name = "rules_distroless",
    version = "0.4.0",
    compatibility_level = 1,
)

# Bazel 8 fails without a working version of protobuf
bazel_dep(name = "protobuf", version = "29.0-rc2.bcr.1")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "aspect_bazel_lib", version = "2.9.4")
bazel_dep(name = "rules_java", version = "8.3.2")

bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
use_repo(bazel_lib_toolchains, "zstd_toolchains")
use_repo(bazel_lib_toolchains, "bsd_tar_toolchains")
use_repo(bazel_lib_toolchains, "yq_darwin_amd64")
use_repo(bazel_lib_toolchains, "yq_darwin_arm64")
use_repo(bazel_lib_toolchains, "yq_linux_amd64")
use_repo(bazel_lib_toolchains, "yq_linux_arm64")
use_repo(bazel_lib_toolchains, "yq_linux_ppc64le")
use_repo(bazel_lib_toolchains, "yq_linux_s390x")
use_repo(bazel_lib_toolchains, "yq_windows_amd64")

# Dev dependencies
bazel_dep(name = "gazelle", version = "0.34.0", dev_dependency = True, repo_name = "bazel_gazelle")
bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.5.0", dev_dependency = True)
bazel_dep(name = "buildifier_prebuilt", version = "6.1.2", dev_dependency = True)
bazel_dep(name = "platforms", version = "0.0.10", dev_dependency = True)
bazel_dep(name = "rules_oci", version = "2.0.0-rc0", dev_dependency = True)
bazel_dep(name = "container_structure_test", version = "1.16.0", dev_dependency = True)
bazel_dep(name = "bazel_features", version = "1.20.0", dev_dependency = True)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "example-bullseye-ca-certificates",
    build_file_content = 'exports_files(["data.tar.xz", "control.tar.xz"])',
    sha256 = "b2d488ad4d8d8adb3ba319fc9cb2cf9909fc42cb82ad239a26c570a2e749c389",
    urls = ["https://snapshot.debian.org/archive/debian/20231106T210201Z/pool/main/c/ca-certificates/ca-certificates_20210119_all.deb"],
)

http_archive(
    name = "example-bullseye-libc-bin",
    build_file_content = 'exports_files(["data.tar.xz"])',
    sha256 = "8b048ab5c7e9f5b7444655541230e689631fd9855c384e8c4a802586d9bbc65a",
    urls = ["https://snapshot.debian.org/archive/debian-security/20231106T230332Z/pool/updates/main/g/glibc/libc-bin_2.31-13+deb11u7_amd64.deb"],
)

http_archive(
    name = "example-bookworm-libc-bin",
    build_file_content = 'exports_files(["data.tar.xz"])',
    sha256 = "38c44247c5b3e864d6db2877edd9c9a0555fc4e23ae271b73d7f527802616df5",
    urls = ["https://snapshot.debian.org/archive/debian-security/20231106T230332Z/pool/updates/main/g/glibc/libc-bin_2.36-9+deb12u3_armhf.deb"],
)

apt = use_extension(
    "@rules_distroless//apt:extensions.bzl",
    "apt",
    dev_dependency = True,
)
apt.install(
    name = "bullseye",
    lock = "//examples/debian_snapshot:bullseye.lock.json",
    manifest = "//examples/debian_snapshot:bullseye.yaml",
)
apt.install(
    name = "bullseye_nolock",
    manifest = "//examples/debian_snapshot:bullseye_nolock.yaml",
    nolock = True,
)
apt.install(
    name = "apt_security",
    manifest = "//examples/debian_snapshot_security:security.yaml",
    nolock = True,
)
apt.install(
    name = "shared_dependencies",
    lock = "//examples/debian_shared_dependencies:bullseye.lock.json",
    manifest = "//examples/debian_shared_dependencies:bullseye.yaml",
)
apt.install(
    name = "noble",
    lock = "//examples/ubuntu_snapshot:noble.lock.json",
    manifest = "//examples/ubuntu_snapshot:noble.yaml",
)
use_repo(apt, "apt_security", "apt_security_resolve", "bullseye", "bullseye_nolock", "noble", "shared_dependencies")
